import VueI18n from "vue-i18n";
import Vue from "vue";
import { getLocale } from '../utils/locale';
import en from './lan/en';
import zh from './lan/zh';
import ElementUI from 'element-ui'
import locale from 'element-ui/lib/locale';
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'

Vue.use(VueI18n);
let _locale = getLocale();
export const i18n = new VueI18n({
    locale:_locale||'en',
    messages:{
        zh:Object.assign(zh, zhLocale),
        en:Object.assign(en, enLocale)
    },
    globalInjection: true, 
})

locale.i18n((key, value) => i18n.t(key, value)) 

export default i18n;